using SalesPages.DomainModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class PressNewMap : EntityTypeConfiguration<PressNew>
    {
        public PressNewMap()
        {
            // Primary Key
            this.HasKey(t => t.News_Id);

            // Properties
            this.Property(t => t.Country)
                .HasMaxLength(50);

            this.Property(t => t.DisplayType)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.ArticleBlurbId)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.ImageName)
                .HasMaxLength(30);

            this.Property(t => t.IsTurnedOn)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(1);

            this.Property(t => t.ImageStyle)
                .HasMaxLength(50);

            this.Property(t => t.SiteVersion)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("PressNews");
            this.Property(t => t.News_Id).HasColumnName("News_Id");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.DisplayType).HasColumnName("DisplayType");
            this.Property(t => t.SummaryBlurbId).HasColumnName("SummaryBlurbId");
            this.Property(t => t.DateCityBlurbId).HasColumnName("DateCityBlurbId");
            this.Property(t => t.TitleBlurbId).HasColumnName("TitleBlurbId");
            this.Property(t => t.ArticleBlurbId).HasColumnName("ArticleBlurbId");
            this.Property(t => t.ImageName).HasColumnName("ImageName");
            this.Property(t => t.IsTurnedOn).HasColumnName("IsTurnedOn");
            this.Property(t => t.PublishTime).HasColumnName("PublishTime");
            this.Property(t => t.ImageStyle).HasColumnName("ImageStyle");
            this.Property(t => t.Priority).HasColumnName("Priority");
            this.Property(t => t.SiteVersion).HasColumnName("SiteVersion");
            this.Property(t => t.MetaTitle).HasColumnName("MetaTitle");
            this.Property(t => t.MetaDesc).HasColumnName("MetaDesc");
            this.Property(t => t.MetaKeyword).HasColumnName("MetaKeyword");
        }
    }
}
